import axios from '../axios';
/**
 * 菜品分析报表请求服务器接口
 * @interface common/api/dishAnalysis
 * @author dym
 */
export default {
  /**
   * @param  {Object} data - 获取销量冠军菜品入参
   * @example 参数 { "timeFlag": 1，"beginTime": 1501516800，"endTime": 1504195199}
   * @returns {Object} 接口返回成功或者失败
   */
  getFoodPopular (data) {
    return axios.postWithSCode('/api/report/food/analysis/popular', data);
  },
  /**
   * @param  {Object} data - 获取门店最能盈利菜品入参
   * @example 参数 { "timeFlag": 1，"beginTime": 1501516800，"endTime": 1504195199}
   * @returns {Object} 接口返回成功或者失败
   */
  getFoodProfitable (data) {
    return axios.postWithSCode('/api/report/food/analysis/profitable', data);
  },
  /**
   * @param  {Object} data - 获取菜品销售额入参
   * @example 参数 { "storeCode": [10086,10010] ,"timeFlag": 1，"beginTime": 1501516800，"endTime": 1504195199}
   * @returns {Object} 接口返回成功或者失败
   */
  getFoodItemSales (data) {
    return axios.postWithSCode('/api/report/food/analysis/item/sales', data);
  },
  /**
   * @param  {Object} data - 获取菜类销售额入参
   * @example 参数 { "timeFlag": 1，"beginTime": 1501516800，"endTime": 1504195199}
   * @returns {Object} 接口返回成功或者失败
   */
  getFoodClassSales (data) {
    return axios.postWithSCode('/api/report/food/analysis/itemclass/sales', data);
  },
  /**
   * @example 参数 { "timeFlag": 1，"beginTime": 1501516800，"endTime": 1504195199}
   * @returns {Object} 接口返回成功或者失败
   */
  getCategory (data) {
    return axios.getService('/api/report/food/analysis/dish/category/' + data);
  },
  /**
   * @param  {Object} data - 获取滞销规则入参
   * @example 参数 { "storeCode": 1}
   * @returns {Object} 接口返回成功或者失败
   */
  getRull (data) {
    return axios.getService('/api/report/food/analysis/dish/dull_rule/' + data);
  },
  /**
   * @param  {Object} data - 设置滞销规则入参
   * @example 参数 { "sellNum": 1, dishCategoryList:[{dishCategoryCode:'12', dishCategoryName: '荤菜'}]}
   * @returns {Object} 接口返回成功或者失败
   */
  setRull (data) {
    return axios.postService('/api/report/food/analysis/dull/rule', data);
  }
};
